#pragma once
#ifdef LIT_OGRE_SUPPORT

#ifndef __LIT__DISPLAY__ENTITY__INCLUDED__HH__
#define __LIT__DISPLAY__ENTITY__INCLUDED__HH__

#include <OgreCamera.h>
#include <OgreSubEntity.h>
#include <OgreEntity.h>

#include <LitMovable.h>

namespace Lit
{
	class LIT_API Entity : public Movable
	{
		OgreEntityPtr		mEntity;
		String			mBaseMesh;
		OgreSceneNodePtr	mBaseParent;
	public:
		Entity( const String &name, const String &mesh, OgreSceneNodePtr parentNode = NULL );
		Entity( Ogre::Entity*getEntity, Ogre::SceneManager * mgr, OgreSceneNodePtr parentNode = NULL );
		Entity( const Entity& rk );
		~Entity( );
		
		Ogre::MeshPtr			getMesh() const;
		String				getMeshName( bool include_ext = true ) const;

		void setMaterial( Ogre::MaterialPtr mat );
		void setMaterialName( const String &mat );
		String getMaterialName( size_t sub_getEntity = 0 )const;

		bool replaceMesh( const String &name );

		void create( OgreSceneManagerPtr mgr );
		void destroy();
		
		OgreEntityPtr operator->();
		const OgreEntityPtr operator->() const;

		OgreEntityPtr getEntity();
		const OgreEntityPtr getEntity() const;
		
		void exportAttribs( TiXmlElement * elem );
		void importAttribs( TiXmlElement * elem );
	};

	typedef RefPtr<Entity>							EntityPtr;
	typedef Vector<EntityPtr>						EntityPtrList;
};

#endif

#endif // IF DEFINED LIT_OGRE_SUPPORT